<template>
	<view class="banc">
		<view class="min">
				<view class="xig">
				<text>账号：</text>	<input id="cer" type="text" placeholder="请填写您的微信账号" style="margin-bottom: 10px;margin-left: 18vw;">
				</view>
				<view class="ka">
				<text>提现：</text>	<input type="text" placeholder="最低提现金额1" style="margin-bottom: 10px;margin-left: 18vw;">
				</view>
				<view class="ka">
				<text style="margin-top: 10px;">收款码：</text>
				<view class="shang">
					<u-upload
							:fileList="fileList1"
							@afterRead="afterRead"
							@delete="deletePic"
							name="1"
							multiple
							:maxCount="10"
						></u-upload>
				</view>
				
				</view>
				<view class="wen">
					<text>当前可提现金额:￥0.00,冻结佣金:￥0</text>
					<br>
					<p style="margin-top: 10px;">说明:每笔佣金的冻结期为0天，到期后可提现</p>
				</view>
				<button @click="sun" style="margin-top: 4vh;background-color: red;color: #fff;border-radius: 20px;">提现</button>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				fileList1: []
			}
		},
		methods:{
			// 删除图片
						deletePic(event) {
							this[`fileList${event.name}`].splice(event.index, 1)
						},
						// 新增图片
						async afterRead(event) {
							// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
							let lists = [].concat(event.file)
							let fileListLen = this[`fileList${event.name}`].length
							lists.map((item) => {
								this[`fileList${event.name}`].push({
									...item,
									status: 'uploading',
									message: '上传中'
								})
							})
							for (let i = 0; i < lists.length; i++) {
								const result = await this.uploadFilePromise(lists[i].url)
								let item = this[`fileList${event.name}`][fileListLen]
								this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
									status: 'success',
									message: '',
									url: result
								}))
								fileListLen++
							}
						},
						uploadFilePromise(url) {
							return new Promise((resolve, reject) => {
								let a = uni.uploadFile({
									url: 'http://192.168.2.21:7001/upload', // 仅为示例，非真实的接口地址
									filePath: url,
									name: 'file',
									formData: {
										user: 'test'
									},
									success: (res) => {
										setTimeout(() => {
											resolve(res.data.data)
										}, 1000)
									}
								});
							})
						},
					
		}
	}
</script>

<style>
	.banc{
		width: 100vw;
	}
	.min{
		width: 90vw;
		margin-top: 40px;
		margin-left: 5vw;
	}
	.xig{
		display: flex;
		border-bottom: 1px solid #ccc;
	}
	.ka{
		margin-top: 10px;
		display: flex;
		border-bottom: 1px solid #ccc;
	}
	.wen{
		color: #7d8891;
		margin-top: 2vh;
	}		
	.shang{
		margin-left: 15vw;
	}
</style>